/**
 * 类名：HttpRequest
 * @author hmb
 * 创建日期： 2014-10-1 上午12:32:38
 *
 * 备注：封装了httpclients请求信息
 * 
 */
package com.erms.util.http;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;

/**
 * @author hmb
 *
 */
public class HttpRequest {
	private Map<String, String> headers = null;
	private List<NameValuePair> params = null;
	/**
	 * 
	 */
	public HttpRequest() {
		// TODO 自动生成的构造函数存根

	}
	public HttpRequest setParam(String key,String value) {
		if (params == null) {
			params = new ArrayList<NameValuePair>();
		}
		params.add(new BasicNameValuePair(key, value));
		return this;
	}
	public HttpRequest setHeader(String key,String value) {
		if (headers ==null) {
			headers = new HashMap<String, String>();
		}
		headers.put(key, value);
		return this;
	}
	public void setCookies(String cookie) {
		if (headers ==null) {
			headers = new HashMap<String, String>();
		}
		headers.put("Cookie",cookie);
	}

	/**
	 * @return headers
	 */
	public Map<String, String> getHeaders() {
		return headers;
	}
	/**
	 * @param headers
	 */
	public void setHeaders(Map<String, String> header) {
		this.headers = header;
	}
	/**
	 * @return params
	 */
	public List<NameValuePair> getParams() {
		return params;
	}
	/**
	 * @param params
	 */
	public void setParams(List<NameValuePair> param) {
		params = param;
	}
}
